//
// Project: Disagreement in science: Missing women



clear all
version 15.1  



use "${data}/output/contest_experiment.dta", clear

keep if plain
generate contest_treatment=enforce
generate treatment_table=.
replace treatment_table=1 if contest_treatment==1
replace treatment_table=2 if contest_treatment==0


// age
local j=1  // variable index
forvalues i=1/2 {  // treatment index
	ttest age if treatment_table==`i', by(female)
	scalar b_0_`i'_`j' = r(mu_1)
	scalar b_1_`i'_`j' = r(mu_2)
	scalar p_`i'_`j' = r(p)
}
local j = `j'+1

// race
local races "race_asian race_black race_latino race_white race_multiple_other"
foreach race of local races {
	forvalues i=1/2 {  // treatment index
		forvalues k=0/1 {  // female index
			sum `race' if female==`k' & treatment_table==`i'
			scalar b_`k'_`i'_`j' = r(mean)
		}
		tab `race' female if treatment_table==`i', chi2
		scalar p_`i'_`j' = r(p)
	}
	local j = `j'+1
}

// residence
local locations "northeast south midwest west"
foreach location of local locations {
	forvalues i=1/2 {  // treatment index
		forvalues k=0/1 {  // female index
			sum `location' if female==`k' & treatment_table==`i'
			scalar b_`k'_`i'_`j' = r(mean)
		}
		tab `location' female if treatment_table==`i', chi2
		scalar p_`i'_`j' = r(p)
	}
	local j = `j'+1
}

// educational attainment
local edu_levels "hs_or_less some_college_but_no_degree college_degree_or_more"
foreach edu of local edu_levels {
	forvalues i=1/2 {  // treatment index
		forvalues k=0/1 {  // female index
			sum `edu' if female==`k' & treatment_table==`i'
			scalar b_`k'_`i'_`j' = r(mean)
		}
		tab `edu' female if treatment_table==`i', chi2
		scalar p_`i'_`j' = r(p)
	}
	local j = `j'+1
}

// high school in the US
forvalues i=1/2 {  // treatment index
	forvalues k=0/1 {  // female index
		sum hs_in_us if female==`k' & treatment_table==`i'
		scalar b_`k'_`i'_`j' = r(mean)
	}
	tab hs_in_us female if treatment_table==`i', chi2
	scalar p_`i'_`j' = r(p)
}
local j = `j'+1

// performance on first incentivize round of task
forvalues i=1/1 {  // treatment index
	forvalues k=0/1 {  // female index
		sum intro1playercorrect_table if female==`k' & treatment_table==`i'
		scalar b_`k'_`i'_`j' = r(mean)
	}
	tab intro1playercorrect_table female if treatment_table==`i', chi2
	scalar p_`i'_`j' = r(p)
}
local j = `j'+1


// performance on additional incentivizes round of task
forvalues i=1/1 {  // treatment index
	forvalues k=0/1 {  // female index
		sum intro1playercorrect_table_extra if female==`k' & treatment_table==`i'
		scalar b_`k'_`i'_`j' = r(mean)
	}
	tab intro1playercorrect_table_extra female if treatment_table==`i', chi2
	scalar p_`i'_`j' = r(p)
}
local j = `j'+1

// belief of self
forvalues i=1/1 {  // treatment index
	ttest intro1playerbelief_self if treatment_table==`i', by(female)
	scalar b_0_`i'_`j' = r(mu_1)
	scalar b_1_`i'_`j' = r(mu_2)
	scalar p_`i'_`j' = r(p)
}
local j = `j'+1

// belief of others
forvalues i=1/1 {  // treatment index
	ttest intro1playerbelief_others if treatment_table==`i', by(female)
	scalar b_0_`i'_`j' = r(mu_1)
	scalar b_1_`i'_`j' = r(mu_2)
	scalar p_`i'_`j' = r(p)
}
local j = `j'+1

// number of subjects
forvalues i=1/2 {  // treatment index
	forvalues k=0/1 {  // female index
		sum intro1playerconsent if female==`k' & treatment_table==`i'
		scalar n_`k'_`i'_`j' = r(N)
	}
}



